﻿<%@ Page Language="C#" MasterPageFile="~/Site.master" CodeBehind="List.aspx.cs" Inherits="salaEstudosEdukanteUsuario.List" %>

<%@ Register Src="~/DynamicData/Content/GridViewPager.ascx" TagName="GridViewPager"
    TagPrefix="asp" %>
<%@ Register Src="~/DynamicData/Content/FilterUserControl.ascx" TagName="DynamicFilter"
    TagPrefix="asp" %>
<%@ Register Assembly="Catalyst.Web.DynamicData" Namespace="Catalyst.Web.DynamicData"
    TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true" />
    <div class="tamanho">
        <h2>
            Lista de Usuários</h2>
        <asp:ScriptManagerProxy runat="server" ID="ScriptManagerProxy1" />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
                    HeaderText="Lista de erros de validação" />
                <asp:DynamicValidator runat="server" ID="GridViewValidator" ControlToValidate="GridView1"
                    Display="None" />
                <asp:DynamicFilterForm ID="DynamicFilterForm1" runat="server" DataSourceID="GridDataSource">
                    <FilterTemplate>
                        Nome do usuário
                        <asp:DynamicFilterControl ID="DynamicFilterControl3" runat="server" DataField="nomeUsuario"
                            FilterMode="Contains" />
                        <asp:Button ID="LinkButton1" runat="server" CommandName="Search" Text="Procurar">
                        </asp:Button><br />
                    </FilterTemplate>
                </asp:DynamicFilterForm><br />
                <asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource" AllowPaging="True"
                    AllowSorting="True" CssClass="gridview" AutoGenerateColumns="False" OnRowDataBound="RowDataBound"
                    Width="99%">
                    <Columns>
                        <asp:DynamicField DataField="nomeUsuario" HeaderText="Nome " />
                        <asp:DynamicField DataField="tipoUsuario" HeaderText="Tipo do usuário " />
                        <asp:DynamicField DataField="emailUsuario" HeaderText="Email " />                        
                        <asp:DynamicField DataField="ativoUsuario" HeaderText="Ativo? " />
                        <asp:TemplateField HeaderText="Ações">
                            <ItemTemplate>
                                <asp:HyperLink ID="EditHyperLink" runat="server" title="Editar" NavigateUrl='<%# table.GetActionPath(PageAction.Edit, GetDataItem()) %>'
                                    ImageUrl="~/images/btEditar.gif" />&nbsp;
                                
                                
                            <asp:LinkButton ID="DeleteLinkButton" runat="server" CommandName="Delete"
                                CausesValidation="false" Text="Excluir" title="Excluir"
                                OnClientClick='return confirm("Tem certeza que deseja excluir o usuário?");'>
                            
                            <img src="<%=ConfigurationManager.AppSettings["url"] %>/images/logo_excluir.png" />
                            
							</asp:LinkButton>
                                
                                &nbsp;
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <PagerStyle CssClass="footer" />
                    <PagerTemplate>
                        <asp:GridViewPager ID="GridViewPager1" runat="server" />
                    </PagerTemplate>
                    <EmptyDataTemplate>
                        Não existem usuários cadastrados no sistema.
                    </EmptyDataTemplate>
                </asp:GridView>
                <asp:DynamicLinqDataSource ID="GridDataSource" runat="server" ContextTypeName="sistemaAcademicoFinanceiroEscolas.modeloDataContext"
                    TableName="usuarios" EnableDelete="True">
                </asp:DynamicLinqDataSource>
                <br />
                <div class="bottomhyperlink">
                    <%--<asp:HyperLink ID="InsertHyperLink" runat="server"><img runat="server" src="~/DynamicData/Content/Images/plus.gif" alt="Cadastrar novo aluno" />&nbsp;Cadastrar novo aluno</asp:HyperLink>--%>
                    <a href="Insert.aspx?informacao=nao">
                        <img id="Img1" runat="server" src="~/DynamicData/Content/Images/plus.gif" alt="Cadastrar novo usuário" />&nbsp;Cadastrar
                        novo usuário</a>
                </div>
                <br>
                <%--<a href="<%=ConfigurationManager.AppSettings["url"]%>/DefaultMenu.aspx">Voltar</a>--%>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>
